package kr.hkit.PowerJava.chapter22.work2.dao;

import java.util.ArrayList;

import kr.hkit.PowerJava.chapter22.work2.vo.Student;

public class StudentMangerImpl implements ItemDaoInterface<Student>{
   private ArrayList<Student> arList;
   
	
	public StudentMangerImpl(ArrayList<Student> arList) {
	super();
	this.arList = arList;
}

	@Override
	public void addItem(Student item) {
		arList.add(item);
		
	}

	@Override
	public void delItem(Student item) {
		arList.remove(item);
		
	}

	@Override
	public void updateItem(Student item) {
		arList.set(arList.indexOf(item), item);
		
	}

	@Override
	public boolean searchItem(Student item) {
		
		return arList.contains(item);
			
		}
	
	

	@Override
	public void prnItems() {
		for(Student std : arList){
		  System.out.println(std);	
		}
		
	}
	public void prnHeader() {
		String str = String
				.format("%3s \t%5s \t%3s \t%3s \t%s \t%s \t%s]"
						stdNum, stdName, kor, eng, math, getTotal(), getAvg());
	}


}
